package com.tmc.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class SessionFactoryUtil {

	public static Configuration config;
	
	static{
		config = new Configuration().configure();
	}
	
	public static SessionFactory getSessionFactory(){
		ServiceRegistryBuilder builder = new ServiceRegistryBuilder().applySettings(config.getProperties());
		ServiceRegistry registry = builder.buildServiceRegistry(); 
		return config.buildSessionFactory(registry); 
	}
}
